package com.bianmaba.services.datacollection;

import com.bianmaba.spring.web.service.BaseService;
import com.bianmaba.beans.datacollection.TaskInstance;
import com.bianmaba.jobs.supports.CollectionResult;
import com.bianmaba.jobs.supports.JobParameter;
import com.bianmaba.repositories.datacollection.TaskInstanceRepository;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * @see ICollectionTaskService
 */
@Service
public class TaskInstanceService extends BaseService<TaskInstance, String> implements ITaskInstanceService {
    private static final Logger LOG = LoggerFactory.getLogger(TaskInstanceService.class);
    @Autowired
    private TaskInstanceRepository repository;


    @Override
    public TaskInstanceRepository getRepository() {
        return repository;
    }

    @Override
    public TaskInstance updateStatus(String taskInstanceId, Integer status) {
        TaskInstance taskInstance = getById(taskInstanceId);
        taskInstance.setStatus(status);
        this.save(taskInstance);
        return taskInstance;
    }
}
